﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero" >
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="Shared.xaml" />
    </ResourceDictionary.MergedDictionaries>
    <Style TargetType="{x:Type ToolBarPanel}">
        <Setter Property="Background" Value="{StaticResource ToolBarPanelBackground}" />
    </Style>
    <Style TargetType="{x:Type ToolBar}">
        <Style.Resources>
            <Style TargetType="{x:Type ToolBarPanel}">
                <Setter Property="Background" Value="{StaticResource ToolBarBackground}" />
            </Style>
        </Style.Resources>
        <Setter Property="Background" Value="{StaticResource ToolBarBackground}" />
        <!--<Setter.Value>
            			<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
            				<GradientStop Color="White" Offset="0"/>
            				<GradientStop Color="#FFFFFBFF" Offset="0.5"/>
            				<GradientStop Color="#FFF7F7F7" Offset="1"/>
            			</LinearGradientBrush>
            		</Setter.Value>
            	</Setter>-->
        <Setter Property="BorderBrush" Value="#FFD5DCE8" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="UseLayoutRounding" Value="True" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToolBar}">
                    <Grid x:Name="Grid" Margin="2,1,1,1" SnapsToDevicePixels="True">
                        <Grid x:Name="OverflowGrid" HorizontalAlignment="Right">
                            <ToggleButton x:Name="OverflowButton" ClickMode="Press" FocusVisualStyle="{x:Null}" IsChecked="{Binding IsOverflowOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" IsEnabled="{TemplateBinding HasOverflowItems}" Foreground="#FF1B283D">
                                <ToggleButton.Style>
                                    <Style TargetType="{x:Type ToggleButton}">
                                        <Setter Property="Background" Value="#FFD5DCE8" />
                                        <Setter Property="MinHeight" Value="0"/>
                                        <Setter Property="MinWidth" Value="0"/>
                                        <Setter Property="Template">
                                            <Setter.Value>
                                                <ControlTemplate TargetType="{x:Type ToggleButton}">
                                                    <Border x:Name="Bd" Background="{TemplateBinding Background}" CornerRadius="0,3,3,0" SnapsToDevicePixels="True">
                                                        <Canvas HorizontalAlignment="Right" Height="7" Margin="7,2,2,2" SnapsToDevicePixels="True" VerticalAlignment="Bottom" Width="6">
                                                            <Path Data="M1,1.5L6,1.5" Stroke="White"/>
                                                            <Path Data="M0,0.5L5,0.5" Stroke="{TemplateBinding Foreground}"/>
                                                            <Path Data="M0.5,4L6.5,4 3.5,7z" Fill="White"/>
                                                            <Path Data="M-0.5,3L5.5,3 2.5,6z" Fill="{TemplateBinding Foreground}"/>
                                                        </Canvas>
                                                    </Border>
                                                    <ControlTemplate.Triggers>
                                                        <Trigger Property="IsMouseOver" Value="True">
                                                            <Setter Property="Background" TargetName="Bd" Value="{StaticResource MouseOverBrush}" />
                                                            <!-- Value="#FFC2E0FF"/> -->
                                                        </Trigger>
                                                        <Trigger Property="IsKeyboardFocused" Value="True">
                                                            <Setter Property="Background" TargetName="Bd" Value="{StaticResource MouseOverBrush}"/>
                                                        </Trigger>
                                                        <Trigger Property="IsEnabled" Value="False">
                                                            <Setter Property="Foreground" Value="#FFC6C3C6"/>
                                                        </Trigger>
                                                    </ControlTemplate.Triggers>
                                                </ControlTemplate>
                                            </Setter.Value>
                                        </Setter>
                                        <Style.Triggers>
                                            <DataTrigger Binding="{Binding}" Value="true">
                                                <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
                                            </DataTrigger>
                                        </Style.Triggers>
                                    </Style>
                                </ToggleButton.Style>
                            </ToggleButton>
                            <Popup x:Name="OverflowPopup" AllowsTransparency="True" Focusable="False" IsOpen="{Binding IsOverflowOpen, RelativeSource={RelativeSource TemplatedParent}}" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Placement="Bottom" StaysOpen="False">
                                <Microsoft_Windows_Themes:SystemDropShadowChrome x:Name="Shdw" Color="Transparent">
                                    <Border x:Name="ToolBarSubMenuBorder" BorderBrush="{StaticResource MenuItemOpenBorderBrush}" BorderThickness="1" Background="#FFFDFDFD" RenderOptions.ClearTypeHint="Enabled">
                                        <ToolBarOverflowPanel x:Name="PART_ToolBarOverflowPanel" KeyboardNavigation.DirectionalNavigation="Cycle" FocusVisualStyle="{x:Null}" Focusable="True" Margin="2" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" KeyboardNavigation.TabNavigation="Cycle" WrapWidth="200"/>
                                    </Border>
                                </Microsoft_Windows_Themes:SystemDropShadowChrome>
                            </Popup>
                        </Grid>
                        <Border x:Name="MainPanelBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}">
                            <Border.Style>
                                <Style TargetType="{x:Type Border}">
                                    <Setter Property="Margin" Value="0,0,11,0"/>
                                    <Setter Property="CornerRadius" Value="3"/>
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding}" Value="true">
                                            <Setter Property="CornerRadius" Value="0"/>
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </Border.Style>
                            <DockPanel KeyboardNavigation.TabIndex="1" KeyboardNavigation.TabNavigation="Local">
                                <Thumb x:Name="ToolBarThumb" Margin="-3,-1,0,0" Padding="6,5,1,6" Width="10" Height="26">
                                    <Thumb.Style>
                                        <Style TargetType="{x:Type Thumb}">
                                            <Setter Property="Template">
                                                <Setter.Value>
                                                    <ControlTemplate TargetType="{x:Type Thumb}">
                                                        <Border Background="Transparent" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="True">
                                                            <Rectangle>
                                                                <Rectangle.Fill>
                                                                    <DrawingBrush TileMode="Tile" Viewbox="0,0,4,4" Viewport="0,0,4,4" ViewportUnits="Absolute" ViewboxUnits="Absolute">
                                                                        <DrawingBrush.Drawing>
                                                                            <DrawingGroup>
                                                                                <GeometryDrawing Brush="#FF60728C" Geometry="M1,1L1,3 3,3 3,1z"/>
                                                                            </DrawingGroup>
                                                                        </DrawingBrush.Drawing>
                                                                    </DrawingBrush>
                                                                </Rectangle.Fill>
                                                            </Rectangle>
                                                        </Border>
                                                        <ControlTemplate.Triggers>
                                                            <Trigger Property="IsMouseOver" Value="True">
                                                                <Setter Property="Cursor" Value="SizeAll"/>
                                                            </Trigger>
                                                        </ControlTemplate.Triggers>
                                                    </ControlTemplate>
                                                </Setter.Value>
                                            </Setter>
                                        </Style>
                                    </Thumb.Style>
                                </Thumb>
                                <ContentPresenter x:Name="ToolBarHeader" ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" ContentStringFormat="{TemplateBinding HeaderStringFormat}" ContentSource="Header" HorizontalAlignment="Center" Margin="4,0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center"/>
                                <ToolBarPanel x:Name="PART_ToolBarPanel" IsItemsHost="True" Margin="0,0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                            </DockPanel>
                        </Border>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsOverflowOpen" Value="True">
                            <Setter Property="IsEnabled" TargetName="ToolBarThumb" Value="False"/>
                        </Trigger>
                        <Trigger Property="Header" Value="{x:Null}">
                            <Setter Property="Visibility" TargetName="ToolBarHeader" Value="Collapsed"/>
                        </Trigger>
                        <Trigger Property="ToolBarTray.IsLocked" Value="True">
                            <Setter Property="Visibility" TargetName="ToolBarThumb" Value="Collapsed"/>
                        </Trigger>
                        <Trigger Property="HasDropShadow" SourceName="OverflowPopup" Value="True">
                            <Setter Property="Margin" TargetName="Shdw" Value="0,0,5,5"/>
                            <Setter Property="SnapsToDevicePixels" TargetName="Shdw" Value="True"/>
                            <Setter Property="Color" TargetName="Shdw" Value="#71000000"/>
                        </Trigger>
                        <Trigger Property="Orientation" Value="Vertical">
                            <Setter Property="Margin" TargetName="Grid" Value="1,3,1,1"/>
                            <Setter Property="Style" TargetName="OverflowButton">
                                <Setter.Value>
                                    <Style TargetType="{x:Type ToggleButton}">
                                        <Setter Property="Background">
                                            <Setter.Value>
                                                <LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
                                                    <GradientStop Color="#FFECECEC" Offset="0"/>
                                                    <GradientStop Color="#FFDDDDDD" Offset="0.5"/>
                                                    <GradientStop Color="#FFA0A0A0" Offset="1"/>
                                                </LinearGradientBrush>
                                            </Setter.Value>
                                        </Setter>
                                        <Setter Property="MinHeight" Value="0"/>
                                        <Setter Property="MinWidth" Value="0"/>
                                        <Setter Property="Template">
                                            <Setter.Value>
                                                <ControlTemplate TargetType="{x:Type ToggleButton}">
                                                    <Border x:Name="Bd" Background="{TemplateBinding Background}" CornerRadius="0,0,3,3" SnapsToDevicePixels="True">
                                                        <Canvas HorizontalAlignment="Right" Height="6" Margin="2,7,2,2" SnapsToDevicePixels="True" VerticalAlignment="Bottom" Width="7">
                                                            <Path Data="M1.5,1L1.5,6" Stroke="White"/>
                                                            <Path Data="M0.5,0L0.5,5" Stroke="{TemplateBinding Foreground}"/>
                                                            <Path Data="M3.5,0.5L7,3.5 4,6.5z" Fill="White"/>
                                                            <Path Data="M3,-0.5L6,2.5 3,5.5z" Fill="{TemplateBinding Foreground}"/>
                                                        </Canvas>
                                                    </Border>
                                                    <ControlTemplate.Triggers>
                                                        <Trigger Property="IsMouseOver" Value="True">
                                                            <Setter Property="Background" TargetName="Bd" Value="#FFC2E0FF"/>
                                                        </Trigger>
                                                        <Trigger Property="IsKeyboardFocused" Value="True">
                                                            <Setter Property="Background" TargetName="Bd" Value="#FFC2E0FF"/>
                                                        </Trigger>
                                                        <Trigger Property="IsEnabled" Value="False">
                                                            <Setter Property="Foreground" Value="#FFC6C3C6"/>
                                                        </Trigger>
                                                    </ControlTemplate.Triggers>
                                                </ControlTemplate>
                                            </Setter.Value>
                                        </Setter>
                                        <Style.Triggers>
                                            <DataTrigger Binding="{Binding}" Value="true">
                                                <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
                                            </DataTrigger>
                                        </Style.Triggers>
                                    </Style>
                                </Setter.Value>
                            </Setter>
                            <Setter Property="Height" TargetName="ToolBarThumb" Value="10"/>
                            <Setter Property="Width" TargetName="ToolBarThumb" Value="Auto"/>
                            <Setter Property="Margin" TargetName="ToolBarThumb" Value="-1,-3,0,0"/>
                            <Setter Property="Padding" TargetName="ToolBarThumb" Value="5,6,6,1"/>
                            <Setter Property="Margin" TargetName="ToolBarHeader" Value="0,0,0,4"/>
                            <Setter Property="Margin" TargetName="PART_ToolBarPanel" Value="1,0,2,2"/>
                            <Setter Property="DockPanel.Dock" TargetName="ToolBarThumb" Value="Top"/>
                            <Setter Property="DockPanel.Dock" TargetName="ToolBarHeader" Value="Top"/>
                            <Setter Property="HorizontalAlignment" TargetName="OverflowGrid" Value="Stretch"/>
                            <Setter Property="VerticalAlignment" TargetName="OverflowGrid" Value="Bottom"/>
                            <Setter Property="Placement" TargetName="OverflowPopup" Value="Right"/>
                            <Setter Property="Margin" TargetName="MainPanelBorder" Value="0,0,0,11"/>
                            <Setter Property="Background">
                                <Setter.Value>
                                    <LinearGradientBrush EndPoint="1,0" StartPoint="0,0">
                                        <GradientStop Color="White" Offset="0"/>
                                        <GradientStop Color="#FFFFFBFF" Offset="0.5"/>
                                        <GradientStop Color="#FFF7F7F7" Offset="1"/>
                                    </LinearGradientBrush>
                                </Setter.Value>
                            </Setter>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <DataTrigger Binding="{Binding}" Value="true">
                <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
            </DataTrigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="{x:Static ToolBar.ButtonStyleKey}" TargetType="{x:Type Button}">
    	<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
    	<Setter Property="Padding" Value="2"/>
    	<Setter Property="BorderThickness" Value="1"/>
    	<Setter Property="Background" Value="Transparent"/>
    	<Setter Property="BorderBrush" Value="Transparent"/>
    	<Setter Property="HorizontalAlignment" Value="Center"/>
    	<Setter Property="VerticalAlignment" Value="Center"/>
    	<Setter Property="HorizontalContentAlignment" Value="Center"/>
    	<Setter Property="VerticalContentAlignment" Value="Center"/>
    	<Setter Property="Template">
    		<Setter.Value>
    			<ControlTemplate TargetType="{x:Type Button}">
    				<Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="True">
    					<ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
    				</Border>
    				<ControlTemplate.Triggers>
    					<Trigger Property="IsMouseOver" Value="True">
    						<Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource MouseOverBorderBrush}"/>
    						<Setter Property="Background" TargetName="Bd" Value="{StaticResource MouseOverBrush}"/>
    					</Trigger>
    					<Trigger Property="IsKeyboardFocused" Value="True">
    						<Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource MouseOverBorderBrush}"/>
    						<Setter Property="Background" TargetName="Bd" Value="{StaticResource MouseOverBrush}"/>
    					</Trigger>
    					<Trigger Property="IsPressed" Value="True">
    						<Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource MouseOverBorderBrush}"/>
    						<Setter Property="Background" TargetName="Bd" Value="{StaticResource PressedBrush}"/>
    					</Trigger>
    					<Trigger Property="IsEnabled" Value="False">
    						<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
    					</Trigger>
    				</ControlTemplate.Triggers>
    			</ControlTemplate>
    		</Setter.Value>
    	</Setter>
    </Style>
    <Style x:Key="{x:Static ToolBar.SeparatorStyleKey}" TargetType="{x:Type Separator}">
    	<Setter Property="Background" Value="{StaticResource ToolBarSeparatorBrush}"/>
    	<Setter Property="MinWidth" Value="1"/>
    	<Setter Property="MinHeight" Value="1"/>
    	<Setter Property="Margin" Value="2"/>
    	<Setter Property="Template">
    		<Setter.Value>
    			<ControlTemplate TargetType="{x:Type Separator}">
    				<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True"/>
    			</ControlTemplate>
    		</Setter.Value>
    	</Setter>
    </Style>
</ResourceDictionary>